<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8" />
	<title>Aloha Editor command remove format tests</title>
	<!-- include qunit -->
	<link rel="stylesheet" href="../../vendor/qunit.css" type="text/css"/>

	<script type="text/javascript" src="../../vendor/qunit.js"></script>

	<script src="../../../lib/require.js" ></script>
	<!-- include jquery -->
	<script	src="../../../lib/vendor/jquery-1.7.2.js" ></script>
	<script type="text/javascript" src="../../vendor/jquery.simulate.js"></script>
	<script>
        require.config({
		    baseUrl: "../"
        });
		var Aloha = {
			settings: {
				jQuery: $,
				baseUrl: '../../../lib'
			}
		};
	</script>

	<!-- include aloha -->
	<script src="../../../lib/aloha.js" ></script>

	<!-- inject into testswarm -->
	<script type="text/javascript" src="../../vendor/swarminject.js"></script>
	<script>
		// load command test suite
		require( ['commandtest'] );
	</script>
	<style type="text/css">
		.aloha-editable ol li { list-style-type: decimal; margin: 1.5em; }
		.aloha-editable ol li ol li{ list-style-type: decimal; margin: 2em; }
	</style>
</head>
<body>
	<!-- include the tests -->
	<script>
	var tests = {
			defaultValue: '',
			defaultCommand: 'removeformat',
			defaultAttributes: [ ],
			tests: [		        
					{  	start: "foo[]bar",
              execResult: "foo[]bar"
          },
          {   exclude: ["webkit", "msie7.0", "msie8.0"],	
					  	start: "<span>foo</span>{}<span>bar</span>",
              execResult: "<span>foo</span>{}<span>bar</span>"
          },
          {   include: ["webkit"],	
					  	start: "<span>foo</span>{}<span>bar</span>",
              execResult: "<span>foo[]</span><span>bar</span>"
          },
          {   exclude: ["webkit", "msie"],	
              start: "<span>foo[</span><span>]bar</span>",
              execResult: "<span>foo[</span><span>]bar</span>"
          },
          {   include: ["webkit"],	
              start: "<span>foo[</span><span>]bar</span>",
              execResult: "<span>foo[]</span><span>bar</span>"
          },
					{  	start: "[foo<b>bar</b>baz]",
              execResult: "[foobarbaz]"
          },
					{  	start: "foo[<b>bar</b>baz]",
              execResult: "foo[barbaz]"
          },
					{  	start: "foo[<b>bar</b>]baz",
              execResult: "foo[bar]baz"
          },
					{  	start: "foo<b>[bar]</b>baz",
              execResult: "foo[bar]baz"
          },
					{  	start: "foo<b>b[a]r</b>baz",
              execResult: "foo<b>b</b>[a]<b>r</b>baz"
          },
					{  	start: "[foo<strong>bar</strong>baz]",
              execResult: "[foobarbaz]"
          },
					{  	start: "[foo<span style=\"font-weight: bold\">bar</span>baz]",
              execResult: "[foobarbaz]"
          },
					{  	start: "foo<span style=\"font-weight: bold\">b[a]r</span>baz",
              execResult: "foo<span style=\"font-weight:bold\">b</span>[a]<span style=\"font-weight:bold\">r</span>baz"
          },
					{  	start: "[foo<span style=\"font-variant: small-caps\">bar</span>baz]",
              execResult: "[foobarbaz]"
          },
					{  	start: "foo<span style=\"font-variant: small-caps\">b[a]r</span>baz",
              execResult: "foo<span style=\"font-variant:small-caps\">b</span>[a]<span style=\"font-variant:small-caps\">r</span>baz"
          },
					{  	start: "[foo<b id=foo>bar</b>baz]",
              execResult: "[foobarbaz]"
          },
					{  	start: "foo<b id=foo>b[a]r</b>baz",
              execResult: "foo<b id=\"foo\">b</b>[a]<b>r</b>baz"
          },
					{  	start: "[foo<a>bar</a>baz]",
              execResult: "[foo<a>bar</a>baz]"
          },
					{  	start: "foo<a>b[a]r</a>baz",
              execResult: "foo<a>b[a]r</a>baz"
          },
					{  	start: "[foo<a href=foo>bar</a>baz]",
              execResult: "[foo<a href=\"foo\">bar</a>baz]"
          },
					{  	start: "foo<a href=foo>b[a]r</a>baz",
              execResult: "foo<a href=\"foo\">b[a]r</a>baz"
          },
					{  	start: "[foo<abbr>bar</abbr>baz]",
              execResult: "[foobarbaz]"
          },
					{  	start: "foo<abbr>b[a]r</abbr>baz",
              execResult: "foo<abbr>b</abbr>[a]<abbr>r</abbr>baz"
          },
					{  	start: "[foo<acronym>bar</acronym>baz]",
              execResult: "[foobarbaz]"
          },
					{  	start: "foo<acronym>b[a]r</acronym>baz",
              execResult: "foo<acronym>b</acronym>[a]<acronym>r</acronym>baz"
          },
					{  	start: "[foo<b>bar</b>baz]",
              execResult: "[foobarbaz]"
          },
					{  	start: "foo<b>b[a]r</b>baz",
              execResult: "foo<b>b</b>[a]<b>r</b>baz"
          },
          // Test fails as MSIE 7/8 doesn't support HTML5 tags.
          {   exclude: ["msie7.0", "msie8.0"],	
              start: "[foo<bdi dir=rtl>bar</bdi>baz]",
              execResult: "[foobarbaz]"
          },
          {   exclude: ["msie7.0", "msie8.0"],	
					  	start: "foo<bdi dir=rtl>b[a]r</bdi>baz",
              execResult: "foo<bdi dir=\"rtl\">b</bdi>[a]<bdi dir=\"rtl\">r</bdi>baz"
          },
					{  	start: "[foo<bdo dir=rtl>bar</bdo>baz]",
              execResult: "[foobarbaz]"
          },
					{  	start: "foo<bdo dir=rtl>b[a]r</bdo>baz",
              execResult: "foo<bdo dir=\"rtl\">b</bdo>[a]<bdo dir=\"rtl\">r</bdo>baz"
          },
					{  	start: "[foo<big>bar</big>baz]",
              execResult: "[foobarbaz]"
          },
					{  	start: "foo<big>b[a]r</big>baz",
              execResult: "foo<big>b</big>[a]<big>r</big>baz"
          },
					{  	start: "[foo<blink>bar</blink>baz]",
              execResult: "[foobarbaz]"
          },
					{  	start: "foo<blink>b[a]r</blink>baz",
              execResult: "foo<blink>b</blink>[a]<blink>r</blink>baz"
          },
					{  	start: "[foo<cite>bar</cite>baz]",
              execResult: "[foobarbaz]"
          },
					{  	start: "foo<cite>b[a]r</cite>baz",
              execResult: "foo<cite>b</cite>[a]<cite>r</cite>baz"
          },
					{  	start: "[foo<code>bar</code>baz]",
              execResult: "[foobarbaz]"
          },
					{  	start: "foo<code>b[a]r</code>baz",
              execResult: "foo<code>b</code>[a]<code>r</code>baz"
          },
					{  	start: "[foo<del>bar</del>baz]",
              execResult: "[foo<del>bar</del>baz]"
          },
					{  	start: "foo<del>b[a]r</del>baz",
              execResult: "foo<del>b[a]r</del>baz"
          },
					{  	start: "[foo<dfn>bar</dfn>baz]",
              execResult: "[foobarbaz]"
          },
					{  	start: "foo<dfn>b[a]r</dfn>baz",
              execResult: "foo<dfn>b</dfn>[a]<dfn>r</dfn>baz"
          },
					{  	start: "[foo<em>bar</em>baz]",
              execResult: "[foobarbaz]"
          },
					{  	start: "foo<em>b[a]r</em>baz",
              execResult: "foo<em>b</em>[a]<em>r</em>baz"
          },
					{  	start: "[foo<font>bar</font>baz]",
              execResult: "[foobarbaz]"
          },
					{  	start: "foo<font>b[a]r</font>baz",
              execResult: "foo<font>b</font>[a]<font>r</font>baz"
          },
					{  	start: "[foo<font color=blue>bar</font>baz]",
              execResult: "[foobarbaz]"
          },
					{  	start: "foo<font color=blue>b[a]r</font>baz",
              execResult: "foo<font color=\"blue\">b</font>[a]<font color=\"blue\">r</font>baz"
          },
					{  	start: "[foo<i>bar</i>baz]",
              execResult: "[foobarbaz]"
          },
					{  	start: "foo<i>b[a]r</i>baz",
              execResult: "foo<i>b</i>[a]<i>r</i>baz"
          },
					{  	start: "[foo<ins>bar</ins>baz]",
              execResult: "[foobarbaz]"
          },
					{  	start: "foo<ins>b[a]r</ins>baz",
              execResult: "foo<ins>b</ins>[a]<ins>r</ins>baz"
          },
					{  	start: "[foo<kbd>bar</kbd>baz]",
              execResult: "[foobarbaz]"
          },
					{  	start: "foo<kbd>b[a]r</kbd>baz",
              execResult: "foo<kbd>b</kbd>[a]<kbd>r</kbd>baz"
          },
          // Test fails as MSIE 7/8 doesn't support HTML5 tags.
          {   exclude: ["msie7.0", "msie8.0"],	
					  	start: "[foo<mark>bar</mark>baz]",
              execResult: "[foobarbaz]"
          },
          {   exclude: ["msie7.0", "msie8.0"],	
					  	start: "foo<mark>b[a]r</mark>baz",
              execResult: "foo<mark>b</mark>[a]<mark>r</mark>baz"
          },
					{  	start: "[foo<nobr>bar</nobr>baz]",
              execResult: "[foobarbaz]"
          },
					{  	start: "foo<nobr>b[a]r</nobr>baz",
              execResult: "foo<nobr>b</nobr>[a]<nobr>r</nobr>baz"
          },
					{  	start: "[foo<q>bar</q>baz]",
              execResult: "[foobarbaz]"
          },
					{  	start: "foo<q>b[a]r</q>baz",
              execResult: "foo<q>b</q>[a]<q>r</q>baz"
          },
					{  	start: "[foo<samp>bar</samp>baz]",
              execResult: "[foobarbaz]"
          },
					{  	start: "foo<samp>b[a]r</samp>baz",
              execResult: "foo<samp>b</samp>[a]<samp>r</samp>baz"
          },
					{  	start: "[foo<s>bar</s>baz]",
              execResult: "[foobarbaz]"
          },
					{  	start: "foo<s>b[a]r</s>baz",
              execResult: "foo<s>b</s>[a]<s>r</s>baz"
          },
					{  	start: "[foo<small>bar</small>baz]",
              execResult: "[foobarbaz]"
          },
					{  	start: "foo<small>b[a]r</small>baz",
              execResult: "foo<small>b</small>[a]<small>r</small>baz"
          },
					{  	start: "[foo<span>bar</span>baz]",
              execResult: "[foobarbaz]"
          },
					{  	start: "foo<span>b[a]r</span>baz",
              execResult: "foo<span>b</span>[a]<span>r</span>baz"
          },
					{  	start: "[foo<strike>bar</strike>baz]",
              execResult: "[foobarbaz]"
          },
					{  	start: "foo<strike>b[a]r</strike>baz",
              execResult: "foo<strike>b</strike>[a]<strike>r</strike>baz"
          },
					{  	start: "[foo<strong>bar</strong>baz]",
              execResult: "[foobarbaz]"
          },
					{  	start: "foo<strong>b[a]r</strong>baz",
              execResult: "foo<strong>b</strong>[a]<strong>r</strong>baz"
          },
					{  	start: "[foo<sub>bar</sub>baz]",
              execResult: "[foobarbaz]"
          },
					{  	start: "foo<sub>b[a]r</sub>baz",
              execResult: "foo<sub>b</sub>[a]<sub>r</sub>baz"
          },
					{  	start: "[foo<sup>bar</sup>baz]",
              execResult: "[foobarbaz]"
          },
					{  	start: "foo<sup>b[a]r</sup>baz",
              execResult: "foo<sup>b</sup>[a]<sup>r</sup>baz"
          },
					{  	start: "[foo<tt>bar</tt>baz]",
              execResult: "[foobarbaz]"
          },
					{  	start: "foo<tt>b[a]r</tt>baz",
              execResult: "foo<tt>b</tt>[a]<tt>r</tt>baz"
          },
					{  	start: "[foo<u>bar</u>baz]",
              execResult: "[foobarbaz]"
          },
					{  	start: "foo<u>b[a]r</u>baz",
              execResult: "foo<u>b</u>[a]<u>r</u>baz"
          },
					{  	start: "[foo<var>bar</var>baz]",
              execResult: "[foobarbaz]"
          },
					{  	start: "foo<var>b[a]r</var>baz",
              execResult: "foo<var>b</var>[a]<var>r</var>baz"
          },
					{  	start: "[foo<br>bar]",
              execResult: "[foo<br>bar]"
          },
          {   exclude: ["msie7.0", "msie8.0"],	
              start: "[foo<hr>bar]",
              execResult: "[foo<hr>bar]"
          },
					{  	start: "[foo<wbr>bar]",
              execResult: "[foo<wbr>bar]"
          },
					{  	start: "[foo<img>bar]",
              execResult: "[foo<img>bar]"
          },
					{  	start: "[foo<img src=abc>bar]",
              execResult: "[foo<img src=\"abc\">bar]"
          },
					{  	start: "[foo<video></video>bar]",
              execResult: "[foo<video></video>bar]"
          },
					{  	start: "[foo<video src=abc></video>bar]",
              execResult: "[foo<video src=\"abc\"></video>bar]"
          },
					{  	start: "[foo<svg><circle fill=blue r=20 cx=20 cy=20 /></svg>bar]",
              execResult: "[foo<svg><circle fill=\"blue\" r=\"20\" cx=\"20\" cy=\"20\"></circle></svg>bar]"
          },
					{  	start: "[foo<nonexistentelement>bar</nonexistentelement>baz]",
              execResult: "[foo<nonexistentelement>bar</nonexistentelement>baz]"
          },
					{  	start: "foo<nonexistentelement>b[a]r</nonexistentelement>baz",
              execResult: "foo<nonexistentelement>b[a]r</nonexistentelement>baz"
          },
					{  	start: "[foo<nonexistentelement style=\"display: block\">bar</nonexistentelement>baz]",
              execResult: "[foo<nonexistentelement style=\"display:block\">bar</nonexistentelement>baz]"
          },
					{  	start: "foo<nonexistentelement style=\"display: block\">b[a]r</nonexistentelement>baz",
              execResult: "foo<nonexistentelement style=\"display:block\">b[a]r</nonexistentelement>baz"
          },
					{  	start: "[foo<span id=foo>bar</span>baz]",
              execResult: "[foobarbaz]"
          },
					{  	start: "foo<span id=foo>b[a]r</span>baz",
              execResult: "foo<span id=\"foo\">b</span>[a]<span>r</span>baz"
          },
					{  	start: "[foo<span class=foo>bar</span>baz]",
              execResult: "[foobarbaz]"
          },
					{  	start: "foo<span class=foo>b[a]r</span>baz",
              execResult: "foo<span class=\"foo\">b</span>[a]<span class=\"foo\">r</span>baz"
          },
					{  	start: "[foo<b style=\"font-weight: normal\">bar</b>baz]",
              execResult: "[foobarbaz]"
          },
					{  	start: "foo<b style=\"font-weight: normal\">b[a]r</b>baz",
              execResult: "foo<b style=\"font-weight:normal\">b</b>[a]<b style=\"font-weight:normal\">r</b>baz"
          },
					{  	start: "<p style=\"background-color: aqua\">foo[bar]baz</p>",
              execResult: "<p style=\"background-color:rgb(0, 255, 255)\">foo[bar]baz</p>"
          },
					{  	start: "<p><span style=\"background-color: aqua\">foo[bar]baz</span></p>",
              execResult: "<p><span style=\"background-color:rgb(0, 255, 255)\">foo</span>[bar]<span style=\"background-color:rgb(0, 255, 255)\">baz</span></p>"
          },
					{  	start: "<p style=\"font-weight: bold\">foo[bar]baz</p>",
              execResult: "<p><b>foo</b>[bar]<b>baz</b></p>"
          },
					{  	start: "<b><p style=\"font-weight: bold\">foo[bar]baz</p></b>",
              execResult: "<p><b>foo</b>[bar]<b>baz</b></p>"
          },
					{  	start: "<p style=\"font-variant: small-caps\">foo[bar]baz</p>",
              execResult: "<p style=\"font-variant:small-caps\">foo[bar]baz</p>"
          },
          {   exclude: ["webkit", "msie7.0", "msie8.0"],	
              start: "{<p style=\"font-variant: small-caps\">foobarbaz</p>}",
              execResult: "{<p style=\"font-variant:small-caps\">foobarbaz</p>}"
          },
          {   include: ["webkit", "msie7.0", "msie8.0"],	
              start: "{<p style=\"font-variant: small-caps\">foobarbaz</p>}",
              execResult: "<p style=\"font-variant:small-caps\">[foobarbaz]</p>"
          },
					{  	start: "<p style=\"text-indent: 2em\">foo[bar]baz</p>",
              execResult: "<p style=\"text-indent:2em\">foo[bar]baz</p>"
          },
          {   exclude: ["webkit", "msie7.0", "msie8.0"],	
              start: "{<p style=\"text-indent: 2em\">foobarbaz</p>}",
              execResult: "{<p style=\"text-indent:2em\">foobarbaz</p>}"
          },
          {   include: ["webkit", "msie7.0", "msie8.0"],	
              start: "{<p style=\"text-indent: 2em\">foobarbaz</p>}",
              execResult: "<p style=\"text-indent:2em\">[foobarbaz]</p>"
          },
          {   exclude: ["webkit", "msie7.0", "msie8.0"],	
              start: "<table data-start=0 data-end=1><tr><td><b>foo</b></table>",
              execResult: "<table>{<tbody><tr><td>foo</td></tr></tbody>}</table>"
          },
          {   include: ["webkit"],	
              start: "<table data-start=0 data-end=1><tr><td><b>foo</b></table>",
              execResult: "{<table><tbody><tr><td>foo</td></tr></tbody></table>}"
          },

          // providing elements to remove
          {  	start: "[foo<span>bar</span>baz]",
              value: ["span", "strike", "strong"],
              execResult: "[foobarbaz]"
          },
          {  	start: "[foo<span>bar</span>baz]",
              value: ["abbr", "acronym"],
              execResult: "[foo<span>bar</span>baz]"
          },
          {   exclude: ["webkit", "msie7.0", "msie8.0"],	
              start: "{<p><i>foo</i><span>bar</span><b>baz</b></p>}",
              value: ["abbr", "b", "span"],
              execResult: "{<p><i>foo</i>barbaz</p>}"
          },
          {   include: ["webkit", "msie7.0", "msie8.0"],	
              start: "{<p><i>foo</i><span>bar</span><b>baz</b></p>}",
              value: ["abbr", "b", "span"],
              execResult: "<p><i>[foo</i>barbaz]</p>"
          },
          {  	start: "[foo<span>b<b>a</b><i>r</i></span>baz]",
              value: ["abbr", "b", "span"],
              execResult: "[fooba<i>r</i>baz]"
          }
      ]
	}
	</script>
	<h1 id="qunit-header">Aloha Editor command remove format tests</h1>
	<h2 id="qunit-banner"></h2>
	<div id="qunit-testrunner-toolbar"></div>
	<h2 id="qunit-userAgent"></h2>
	<ol id="qunit-tests"></ol>
	<div id="qunit-fixture"></div>
	<div id="edit" style="margin:20px; border:1px solid #000000;"></div>
	<div id="logBody"></div>
	</div>
</body>
</html>
